<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <title>购物车</title>

    <div th:replace="common_cssjs"></div>
    <link type="text/css" rel="stylesheet" media="screen" th:href="@{/css/index.css}">
    <script th:src="@{/js/product.js}" type="text/javascript"></script>
    <script th:src="@{/js/cart.js}" type="text/javascript"></script>

</head>

<body>
<div th:replace="common/header::nav"></div>
<div class="container">
    <div class="row">
        <div class="text-center" th:if="${session.cart} == null or ${session.cart.isEmpty()}">
            <tr>
                <td>购物车为空，继续去选购商品吧...</td>
            </tr>
        </div>
        <table class="table table-responsive table-striped" th:unless="${session.cart} == null or ${session.cart.isEmpty()}">
            <thead>
            <tr>
                <td>名称</td>
                <td>型号</td>
                <td>编码</td>
                <td>价格</td>
                <td>数量</td>
                <td>操作</td>
            </tr>
            </thead>
            <tbody>
            <tr th:each="ci : ${cartItems}" pid="${ci.value.product.id}">
                <td th:text="${ci.value.product.title}">商品名称</td>
                <td th:text="${ci.value.product.model}">型号</td>
                <td th:text="${ci.value.product.code}">编码</td>
                <td th:text="${ci.value.product.point}">价格</td>
                <td><a class="btn btn-default btn-xs delTotal">-</a> <label
                        productid="${ci.value.product.id}" th:text="${ci.value.total}">100</label> <a
                        class="btn btn-default btn-xs addTotal">+</a></td>
                <td><a class="btn btn-info delBtn btn-xs" th:productid="@{${ci.value.product.id}}">删除</a></td>
            </tr>
            </tbody>
        </table>
        <div id="delSuccess" class="alert alert-success" style="display: none;">删除成功...</div>
        <div id="delAllSuccess" class="alert alert-success" style="display: none;">购物车清空成功....</div>
    </div>
    <div class="row">
        <div class="col-md-6 col-xs-9">
            <a class="btn btn-info" th:href="@{'/'}">继续购买</a>
            <a class="btn btn-info" id="cleanCart">清空购物车</a>
        </div>
        <div class="col-md-6 col-xs-3 text-right">
            <a class="btn btn-primary" th:href="@{'/user/order/purchase/'}" href="/user/order/purchase/">结账</a>
        </div>
    </div>
</div>

</div>
<!-- /container -->
<div th:replace="common/footer::copy"></div>
</body>
</html>